﻿Public Class FrmNF
    Inherits Trading.FrmBase

    Private Sub Visualizar(ByVal entity As Model.NfPesquisa) Handles UcNFPesquisa1.Visualizar
        UcNFCadastro1.Visualiza(entity)

        StatusFrm(FrmModo.Edit)
    End Sub


    Private Sub Incluir() Handles UcNFPesquisa1.Incluir
        ' Algo assim
        UcNFCadastro1.Novo()

        StatusFrm(FrmModo.Insert)
    End Sub


    Private Sub Salvo() Handles UcNFCadastro1.Salvo
        StatusFrm(FrmModo.Viewer)
    End Sub

    Private Sub Cancelado() Handles UcNFCadastro1.Cancelado
        StatusFrm(FrmModo.Viewer)
    End Sub


    Private Sub StatusFrm(ByVal Modo As FrmModo)
        If Modo = FrmModo.Insert Or Modo = FrmModo.Edit Then
            UcNFPesquisa1.Visible = False
            UcNFCadastro1.Visible = True
        End If
        If Modo = FrmModo.Viewer Then
            UcNFPesquisa1.Visible = True
            UcNFCadastro1.Visible = False
        End If
    End Sub

    Private Sub Sair() Handles UcNFPesquisa1.Sair
        Me.Close()
    End Sub

End Class